<template>
	<view>
		<view class="icon">
			<image src="/static/images/s46.png" v-if="code==1"></image>
			<image src="/static/images/s47.png" v-else></image>
		</view>
		<view class="tis" v-if="code==1">
			订单支付成功
		</view>
		<view class="tis" v-else >
			订单支付失败
		</view>
		<view class="pay-amount"  v-if="code==1">
			支付金额:{{amount}}元
		</view>
		<view class="pay-amount" v-else >
			支付金额:{{0.00}}元
		</view>
		<view class="back">
			<view class="btn" @tap="toUser">查看订单</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				amount:0,
				code:''
			};
		},
		onBackPress(res){
			if(res.from === 'backbutton'){
				uni.switchTab({
					url:'/pages/user/user'
				})
				return true;
			}
		},
		onLoad(e) {
			this.amount = parseFloat(e.amount).toFixed(2);
			this.code = e.code	
		},
		methods: {
			toUser() {
				uni.switchTab({
					url: '/pages/user/user'
				});
			}
		},
	}
</script>

<style lang="scss">
	view{
		display: flex;
		flex-wrap: wrap;
		justify-content: center;
	}
.icon{
	width: 100%;
	margin-top: 10vw;
	image{
		width: 25vw;
		height: 25vw;
	}
}
.tis{
	width: 100%;
	margin-top: 20upx;
	font-size: 48upx;
}
.pay-amount{
	width: 100%;
	margin-top: 10upx;
	font-size: 32upx;
}
.back{
	position: absolute;
	width: 100%;
	bottom: 80upx;
	.btn{
		padding: 0 50upx;
		height: 70upx;
		border: solid 2upx #f06c7a;
		color: #f06c7a;
		align-items: center;
		border-radius: 10upx;
		font-size: 34upx;
	}
}
</style>
